package cn.iocoder.yudao.framework.security.config;

import cn.iocoder.yudao.framework.web.config.WebProperties;
import org.springframework.core.Ordered;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer;

import javax.annotation.Resource;


/**
 * @author ext.gouying3
 * @date 2025/7/15
 */
public abstract class AuthorizeRequestsCustomizer
        implements Customizer<AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry>, Ordered {

    @Resource
    private WebProperties webProperties;


    protected String buildAdminApi(String url){
        return webProperties.getAdminApi().getPrefix()  + url;
    }


    protected String buildAppApi(String url){
        return webProperties.getAppApi().getPrefix()  + url;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
